﻿using System.IO;

namespace Csharp.Comum
{
    public sealed class MoverArquivo
    {

        public static void Mover(string pathLocal, string pathDestino)
        {
            if (!File.Exists(pathLocal))
            {
                // This statement ensures that the file is created,
                // but the handle is not kept.
                using (FileStream fs = File.Create(pathLocal)) 
                {}
            }

            // Ensure that the target does not exist.
            if (File.Exists(pathDestino))
                File.Delete(pathDestino);

            // Move the file.
            File.Move(pathLocal, pathDestino);
        }
    }
}
